var payObj = {
    userid: "",
    lTeamId: "",
    init: function() {
        this.userid = $.cookie('userid');
        this.lTeamId = publicObj.getUrlData("lTeamId");
        this.getGroupInfor();
    },
    //拼团信息
    getGroupInfor: function() {
        var me = this;
        var url = magic_config.urlPrefix + 'GroupbuyService/getallgroupbuyinfo';
        var sUserIdStr;
        if (me.userid == null) {
            sUserIdStr = "";
        } else {
            sUserIdStr = me.userid;
        }
        var data = {
            lTeamId: me.lTeamId,
            sUserId: sUserIdStr
        }
        $.ajax({
            url: url,
            type: 'get',
            data: data,
            async: false,
            dataType: 'json',
            success: function(res) {
                var nCode = res.return.nCode;
                if (nCode === 0) {
                    me.splitGroupinfor(res.response);
                } else {
                    console.log("数据请求失败，后到前");
                }
            },
            error: function(res) {
                console.log("数据请求失败，前到后");
            }
        });
    },
    splitGroupinfor: function(resObj) {
        var groulpCount = resObj.cdoData.nCountPerGroup;
        var groupList = resObj.cdoDataList;
        var goodsDetail = resObj.cdoData;
        var orderObj = resObj.cdoOrderData;
        console.log(resObj);
        //组团信息相关
        var str = '';
        for (var i = 0; i < 5; i++) {
            if (i == 0) {
                str += '<div class="userimgwall"><div class="userimg"><img src="' + groupList[i].sUserPhoto + '" alt="" /></div><div class="leader">拼主</div></div>';
            } else {
                if (i < groupList.length) {
                    str += '<div class="userimgwall"><div class="userimg"><img src="' + groupList[i].sUserPhoto + '" alt="" /></div></div>';
                } else {
                    str += '<div class="userimgwall"><div class="userimg userimg2"><img src="./img/himg.png" alt=""></div></div>';
                }
            }
        }
        $('.userimgbox').html(str);
        //商品信息相关
         $(".goodsname").html('【'+goodsDetail.sCorpName+'】'+goodsDetail.sName);
        $(".goodsprc").html('<span>拼团价&nbsp&nbsp:&nbsp&nbsp¥&nbsp</span>' + goodsDetail.nGroupPrice);
        $(".paytip").html('实付：<b>￥</b><span>' + goodsDetail.nGroupPrice + '</span>');
        $(".goodsoprc").html("¥" + goodsDetail.nMainPrice);
        $(".groupnum").html('<span>' + goodsDetail.nCountPerGroup + '</span>人参与');
        $(".goodsimg").html('<img src="' + goodsDetail.sHeadPicture + '" alt="" />');
        //订单信息相关
        console.log(orderObj);
        $(".ordertxt1").html(orderObj.lOrderId);
        $(".ordertxt2").html('微信支付');
        $(".ordertxt3").html(orderObj.dPaySuccessTime);
        $(".ptstatutip").html('快去'+goodsDetail.sCorpName+'购物吧～');
    },

};
payObj.init();